Skip to content

Conversation

@pranaygp
Copy link
Collaborator

Seeing this issue sporadically when trying to getReadable with a startIndex in local world only

[ResponseAborted: ]
 ⨯ unhandledRejection: [ResponseAborted: ]
 ⨯ unhandledRejection:  [ResponseAborted: ]
[Error: failed to pipe response] {
  [cause]: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
      at Object.pull (../src/serialization.ts:109:22) {
    code: 'ERR_INVALID_STATE'
  }
}
TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection:  TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 GET /api/chat/wrun_01KAHQY0R34C8TY6AD4AJWXAB8/stream?startIndex=154 500 in 315ms
[Error: failed to pipe response] {
  [cause]: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
      at Object.pull (../src/serialization.ts:109:22) {
    code: 'ERR_INVALID_STATE'
  }
}
TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection:  TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 GET /api/chat/wrun_01KAHQY0R34C8TY6AD4AJWXAB8/stream?startIndex=0 500 in 439ms
 GET /api/chat/wrun_01KAHQY0R34C8TY6AD4AJWXAB8/stream?startIndex=0 200 in 342ms
[ResponseAborted: ]
 ⨯ unhandledRejection: [ResponseAborted: ]
 ⨯ unhandledRejection:  [ResponseAborted: ]
[Error: failed to pipe response] {
  [cause]: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
      at Object.pull (../src/serialization.ts:109:22) {
    code: 'ERR_INVALID_STATE'
  }
}
TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 ⨯ unhandledRejection:  TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
    at Object.pull (../src/serialization.ts:109:22) {
  code: 'ERR_INVALID_STATE'
}
 GET /api/chat/wrun_01KAHQY0R34C8TY6AD4AJWXAB8/stream?startIndex=154 500 in 317ms
 GET /api/sandboxes/sbx_4gdk1rJBB2LcduwqxVEbMwiQipxN 200 in 1061ms
[Error: failed to pipe response] {
  [cause]: TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached
      at Object.pull (../src/serialization.ts:109:22) {
    code: 'ERR_IN..

this branch is to fix and test

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: ce4263e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@workflow/world-local Patch
@workflow/cli Patch
@workflow/core Patch
@workflow/world-postgres Patch
workflow Patch
@workflow/world-testing Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/web-shared Patch
@workflow/ai Patch
@workflow/sveltekit Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 22, 2025 0:22am
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 22, 2025 0:22am
example-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-astro-workflow Error Error Nov 22, 2025 0:22am
workbench-express-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-hono-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-nitro-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-nuxt-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-sveltekit-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workbench-vite-workflow Ready Ready Preview Comment Nov 22, 2025 0:22am
workflow-docs Ready Ready Preview Comment Nov 22, 2025 0:22am

@vercel vercel bot temporarily deployed to Preview – workflow-docs November 21, 2025 16:36 Inactive
@pranaygp pranaygp force-pushed the pranaygp/fix-local-streaming branch from 075bf43 to b4c42f7 Compare November 21, 2025 16:48
@vercel
Copy link
Contributor

vercel bot commented Nov 21, 2025

You must have Developer access to commit code to Vercel Labs on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

@vercel
Copy link
Contributor

vercel bot commented Nov 21, 2025

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: workflow-docs.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

}
if (chunk.chunk.byteLength) {
controller.enqueue(chunk.chunk);
process.stdout.write('.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process.stdout.write('.');

Debug output code (process.stdout.write('.')) was accidentally left in the production fix and should be removed.

View Details

Analysis

Debug output code accidentally left in stream reader

What fails: The readFromStream() function in packages/world-local/src/streamer.ts (line 185) writes a debug dot character to stdout every time a chunk is enqueued during stream reading, polluting stdout with unwanted output.

How to reproduce: Create a stream with multiple chunks and read from it:

const streamer = createStreamer('./test-data');
const chunks = ['chunk1', 'chunk2', 'chunk3'];
for (const chunk of chunks) {
  await streamer.writeToStream('test-stream', Promise.resolve('run-1'), chunk);
}
await streamer.closeStream('test-stream', Promise.resolve('run-1'));

const stream = await streamer.readFromStream('test-stream');
const reader = stream.getReader();
while (true) {
  const { done } = await reader.read();
  if (done) break;
  // Observe: three dots printed to stdout (one per chunk)
}

Result: Three dots appear on stdout, one for each chunk enqueued

Expected: No debug output should appear on stdout. The function should silently enqueue chunks without printing to console.

Root cause: Commit d6b97db ("another fix") inadvertently added process.stdout.write('.'); at line 185, which should have been removed before commit. This was not mentioned in the commit message and is not part of the intended fix ("Create a copy of the data when resolving a stream to prevent detachment").

.

another fix

.

.
{
"name": "@workflow/world-local",
"version": "5.0.0-beta.10",
"version": "4.0.0-beta.10",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "4.0.0-beta.10",
"version": "5.0.0-beta.11",

The package version was downgraded from 5.0.0-beta.10 to 4.0.0-beta.10, which is backwards and will cause version conflicts.

View Details

Analysis

Version downgrade in @workflow/world-local package

What fails: The version in packages/world-local/package.json was incorrectly downgraded from 5.0.0-beta.10 to 4.0.0-beta.10, violating semantic versioning and causing version conflicts with package managers.

How to reproduce:

# Check git history
git log --oneline -5 -- packages/world-local/package.json
# Commit ce4263e has version "4.0.0-beta.10" (incorrect)
# Commit 2856d66 has version "5.0.0-beta.10" (correct - previous version)

Result: Version downgraded from 5.0.0-beta.10 to 4.0.0-beta.10, which is a backward version change. The associated changeset specifies "patch" level changes but the version number went DOWN instead of UP.

Expected: Version should be 5.0.0-beta.11 (bumping the patch version from the previous beta.10), maintaining proper semver progression. Per semantic versioning, patch versions must increment monotonically within the same major and minor version.

Fixed: Version corrected to 5.0.0-beta.11 to maintain proper version ordering and consistency with the "patch" level changeset.

@pranaygp
Copy link
Collaborator Author

Superseded by #391

@pranaygp pranaygp closed this Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants